Requirements of the Gaming API
Let's define the functional and non-functional requirements for a multiplayer gaming API.
Introduction#
The gaming industry is diverse and plays a significant part in entertainment, manufacturing, education, socialization, and other areas. This makes designing and developing these systems from scratch an intricate process. As a result, many vendors create general-purpose versions of their game APIs and offer backend as a service (BaaS), a service model that outsources basic and common functionalities that can be used in a variety of development scenarios, to facilitate other developers. Designing a gaming API is difficult since there are several elements to consider including managing resources (game stats, user information, leaderboards, etc.), real-time communication (chat, audio conferencing, etc.), simulation, streaming (live streaming to a platform like YouTube), as well as the actual gameplay, which are all complex problems themselves. For the sake of understanding the subtleties, let's take a multiplayer online game as an example and design an API for it.
Requirements#
Modern games support a large number of functions. This is because players choose the game they want to play based on the supported features. Let's define some common requirements for our API that most games support.
Functional requirements#
Gameplay: The API should allow players to join and leave different game modes, such as one-on-one and multiplayer.
Chat messages: The API should allow players to send and receive text messages.
Audio conferencing: The API should allow players to communicate using audio streams.
In-app purchases: The API should allow players to purchase different gadgets and assets provided in the game store.
Event notification: The API should notify players about the most recent events, such as tournaments and so on.
Non-functional requirements#
Availability: APIs should be highly available to provide an uninterrupted gaming experience to players worldwide.
Scalability: The service should scale seamlessly to handle the increasing numbers of players as the game becomes more popular.
Security: APIs should include safeguards against in-game hacking and cheat activation.
Low latency: The service should minimize lag as much as possible so players can play the game smoothly.
Prerequisites#
Some of the functional requirements have been discussed in previous chapters. These will serve as the basis for designing our gaming API. Before continuing, we strongly recommend that you read through the following service designs:
Pub-sub service: Players can be updated about new tournaments and assets using the pub-sub service.
Zoom API design: Players can communicate with each other using the audio/video conferencing service.
Messenger API design: Players can chat with each other using the text messaging service.
Payment gateway API design: Players can purchase assets using the payment gateway service.
Note: Please note that real games don't necessarily use external services like Messenger to allow gamers to chat or Zoom to make voice calls. We shared the above prerequisites because the gaming API provides functionalities similar to the ones discussed in the above-mentioned design problem. However, the gaming API does not discuss the above functionalities in detail.
How will we design gaming API?#
The following lessons make up this chapter:
Introduction to the Gaming Ecosystem: This lesson briefly introduces the gaming industry and the entities involved in the gaming ecosystem.
Gaming API Design Decisions: This lesson decides on different design aspects such as architectural style, communication protocols, etc.
API Model for Gaming Service: This lesson models different API endpoints to meet the various functional requirements of the communication.
Gaming API Design Evaluation and Latency Budget: This lesson discusses different non-functional requirements and estimates the latency of our game API.
CamelCamelCamel API Design Evaluation and Latency Budget
Introduction to the Gaming Ecosystem